package 结业考试;

public class MyStringTest {
    public static void main(String[] args) {
        String r1 = "hello java";
        String r2 = "hello java";

        if (r1.equals(r2)) {   //判断两个字符串是否相等
            r1 = r1.replace(" ", "");   //替换
            System.out.println(r1);
            r1 = r1.replace("java", "word");
            System.out.println(r1);   //打印修改过的r1
        } else {
            System.out.println("两个字符串不相等");
        }
    }
}
//求两个字符串是否相等